package com.yjhh.scala

/**
  * Created by wangchun on 17/11/19.
  */

trait Logger {

  def log(message: String) {
    println("Logger : " + message)
  }

}

trait RichLogger extends Logger {

  override def log(message: String) = println("RichLogger : " + message)

}

class Loggin(val name: String) extends Logger {
  // with RichLogger{

  def login: Unit = println("Hi ,welcome ! " + name)

}

trait Information {
  def getInformation: String

  def checkIn: Boolean = {
    getInformation.equals("Spark")
  }
}

class Passenger(val name: String) extends Information {
  def getInformation = name
}

object HelloTrait {

  def main(args: Array[String]): Unit = {
    //动态的改变了方法的实现

    val personLogin = new Loggin("Spark") with RichLogger
    personLogin.login
  }

}
